package com.cn.wanxi.service.impl;

import com.cn.wanxi.dao.ProductDao;
import com.cn.wanxi.dao.impl.ProductImpl;
import com.cn.wanxi.model.ProductModel;
import com.cn.wanxi.model.ResultModel;
import com.cn.wanxi.service.EnableService;
import com.cn.wanxi.service.ProductService;

public class ProductServiceImpl implements ProductService, EnableService {
    private ProductDao productDao = new ProductImpl();

    @Override
    public ResultModel add(ProductModel productModel) {
        return ResultModel.getResultModel(productDao.add(productModel));
    }

    @Override
    public ResultModel deltete(ProductModel productModel) {
        return null;
    }

    @Override
    public ResultModel update(ProductModel productModel) {
        return ResultModel.getResultModel(productDao.update(productModel));
    }

    @Override
    public ResultModel findAll(ProductModel productModel) {
        return ResultModel.getResultModel(productDao.getCount(productModel), productDao.findAll(productModel));
    }

    @Override
    public ResultModel findById(ProductModel productModel) {
        return null;
    }

    @Override
    public ResultModel getCount(ProductModel productModel) {
        return null;
    }

    @Override
    public ResultModel enable(ProductModel productModel) {
        return ResultModel.getResultModel(productDao.enable(productModel));
    }

    @Override
    public ResultModel enable(int id) {
        return null;
    }
}
